package com.atguigu.state.money;

class FeedBackState extends AbstractState{
	@Override
	public String getCurrentState() {
		return StateEnum.FEED_BACK.getValue();
	}
}

class GenerateState extends AbstractState{
	@Override
	public void checkEvent(Context context) {
		context.setState(new ReviewState());
	}
	@Override
	public void checkFailEvent(Context context) {
		context.setState(new FeedBackState());
	}
}

class NotPayState extends AbstractState{
	@Override
	public void payOrderEvent(Context context) {
		context.setState(new PaidState());
	}
	@Override
	public void feedbackEvent(Context context) {
		context.setState(new FeedBackState());
	}
	@Override
	public String getCurrentState() {
		return StateEnum.NOT_PAY.getValue();
	}
}

class PaidState extends AbstractState{
	@Override
	public void feedbackEvent(Context context) {
		context.setState(new FeedBackState());
	}
	@Override
	public String getCurrentState() {
		return StateEnum.PAID.getValue();
	}
}

class PublishState extends AbstractState{
	@Override
	public void acceptOrderEvent(Context context) {
		context.setState(new NotPayState());
	}
	@Override
	public void notPeopleAcceptEvent(Context context) {
		context.setState(new FeedBackState());
	}
	@Override
	public String getCurrentState() {
		return StateEnum.PUBLISHED.getValue();
	}
}

class ReviewState extends AbstractState{
	@Override
	public void makePriceEvent(Context context) {
		context.setState(new NotPayState());
	}
	
	@Override
	public String getCurrentState() {
		return super.getCurrentState();
	}
}